package com.example.myapplication.MainFragment;

import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.example.myapplication.MineAdapter.MineAdapter;
import com.example.myapplication.MineBean.MineBean;
import com.example.myapplication.R;

import java.util.ArrayList;
import java.util.List;

public class FragmentMine extends Fragment {
    GridView Mine_gv;
    List<MineBean> list=new ArrayList<>();
    MineAdapter mineAdapter;
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view=inflater.inflate(R.layout.fragment_me,container,false);
        initView(view);
        return view;
    }

    private void initView(View view) {
        //绑定控件
        Mine_gv=view.findViewById(R.id.Mine_gv);

        //添加数据
        list.add(new MineBean(R.mipmap.jinqihuodong,"近期活动"));
        list.add(new MineBean(R.mipmap.kaoshidongtai,"考试动态"));
        list.add(new MineBean(R.mipmap.beikaoxiaozu,"备考小组"));
        list.add(new MineBean(R.mipmap.yaoqinghaoyuo,"邀请好友"));
        list.add(new MineBean(R.mipmap.wodexiaoxi,"我的消息"));
        list.add(new MineBean(R.mipmap.peibankaoshi,"陪伴考试"));
        Log.i("1","1"+list);
        //初始化适配器
        mineAdapter=new MineAdapter(list,getActivity());
        Log.i("1","1");
        //绑定适配器
        Mine_gv.setAdapter(mineAdapter);
        Log.i("1","1");

    }
}
